smartbuck6 2.2.0
Loading...
Searching...
No Matches
smartbuck6


Smart Buck 6 Click

Smart Buck 6 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : May 2025.
  • Type : I2C type

Software Support

Example Description

This example demonstrates the use of the Smart Buck 6 Click board. The application changes the output voltage of all three buck converters (A, B, and C) in a periodic manner and logs the output current of each. It also monitors the PG (Power Good) pin to detect and log any fault conditions such as over-temperature, overvoltage, undervoltage, or overcurrent.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.SmartBuck6

Example Key Functions

  • smartbuck6_cfg_setup This function initializes Click configuration structure to initial values.
    void smartbuck6_cfg_setup(smartbuck6_cfg_t *cfg)
    Smart Buck 6 configuration object setup function.
    Smart Buck 6 Click configuration object.
    Definition smartbuck6.h:314
  • smartbuck6_init This function initializes all necessary pins and peripherals used for this Click board.
    err_t smartbuck6_init(smartbuck6_t *ctx, smartbuck6_cfg_t *cfg)
    Smart Buck 6 initialization function.
    Smart Buck 6 Click context object.
    Definition smartbuck6.h:294
  • smartbuck6_default_cfg This function executes a default configuration of Smart Buck 6 Click board.
    err_t smartbuck6_default_cfg(smartbuck6_t *ctx)
    Smart Buck 6 default configuration function.
  • smartbuck6_set_buck_vout This function sets the output voltage for one or more buck regulators.
    err_t smartbuck6_set_buck_vout ( smartbuck6_t *ctx, uint8_t buck_sel, uint16_t vout_mv );
    err_t smartbuck6_set_buck_vout(smartbuck6_t *ctx, uint8_t buck_sel, uint16_t vout_mv)
    Smart Buck 6 set output voltage function.
  • smartbuck6_read_buck_current This function reads and returns the output current of the selected buck regulator.
    err_t smartbuck6_read_buck_current ( smartbuck6_t *ctx, uint8_t buck_sel, uint16_t *current_ma );
    err_t smartbuck6_read_buck_current(smartbuck6_t *ctx, uint8_t buck_sel, uint16_t *current_ma)
    Smart Buck 6 read buck output current function.
  • smartbuck6_get_pg_pin This function reads the logic level of the PG pin.
    uint8_t smartbuck6_get_pg_pin(smartbuck6_t *ctx)
    Smart Buck 6 get power-good pin function.

Application Init

Initializes the logger and the Smart Buck 6 Click driver and applies the default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
smartbuck6_cfg_t smartbuck6_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
smartbuck6_cfg_setup( &smartbuck6_cfg );
SMARTBUCK6_MAP_MIKROBUS( smartbuck6_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == smartbuck6_init( &smartbuck6, &smartbuck6_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( SMARTBUCK6_ERROR == smartbuck6_default_cfg ( &smartbuck6 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define SMARTBUCK6_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition smartbuck6.h:268
void application_init(void)
Definition main.c:46
@ SMARTBUCK6_ERROR
Definition smartbuck6.h:333

Application Task

Periodically increases or decreases the output voltage, reads and logs the output current for each buck channel, and checks for any fault conditions indicated via the PG pin and status registers.

void application_task ( void )
{
static uint16_t vout = SMARTBUCK6_VOUT_MV_MIN;
static int16_t vout_step = 200;
uint16_t current = 0;
if ( smartbuck6_get_pg_pin ( &smartbuck6 ) )
{
log_printf( &logger, "\r\n Fault indication detected via PG pin!\r\n" );
if ( SMARTBUCK6_OK == smartbuck6_read_status ( &smartbuck6, &status ) )
{
smartbuck6_display_status ( status );
}
smartbuck6_clear_status( &smartbuck6 );
}
{
log_printf ( &logger, "\r\n All outputs voltage: %u mV\r\n", vout );
vout += vout_step;
if ( ( vout > SMARTBUCK6_VOUT_MV_MAX ) || ( vout < SMARTBUCK6_VOUT_MV_MIN ) )
{
vout_step = -vout_step;
vout += vout_step;
vout += vout_step;
}
Delay_ms ( 100 );
if ( SMARTBUCK6_OK == smartbuck6_read_buck_current ( &smartbuck6, SMARTBUCK6_BUCK_A, &current ) )
{
log_printf ( &logger, " Buck A current: %u mA\r\n", current );
}
if ( SMARTBUCK6_OK == smartbuck6_read_buck_current ( &smartbuck6, SMARTBUCK6_BUCK_B, &current ) )
{
log_printf ( &logger, " Buck B current: %u mA\r\n", current );
}
if ( SMARTBUCK6_OK == smartbuck6_read_buck_current ( &smartbuck6, SMARTBUCK6_BUCK_C, &current ) )
{
log_printf ( &logger, " Buck C current: %u mA\r\n", current );
}
}
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
#define SMARTBUCK6_VOUT_MV_MAX
Definition smartbuck6.h:226
#define SMARTBUCK6_BUCK_C
Smart Buck 6 buck selection setting.
Definition smartbuck6.h:216
#define SMARTBUCK6_VOUT_MV_MIN
Smart Buck 6 vout setting.
Definition smartbuck6.h:225
#define SMARTBUCK6_BUCK_B
Definition smartbuck6.h:217
#define SMARTBUCK6_BUCK_A
Definition smartbuck6.h:218
#define SMARTBUCK6_BUCK_ALL
Definition smartbuck6.h:219
err_t smartbuck6_clear_status(smartbuck6_t *ctx)
Smart Buck 6 clear status flags function.
err_t smartbuck6_read_status(smartbuck6_t *ctx, smartbuck6_status_t *status)
Smart Buck 6 read status registers function.
void application_task(void)
Definition main.c:82
@ SMARTBUCK6_OK
Definition smartbuck6.h:332
Smart Buck 6 Click status object.
Definition smartbuck6.h:282

Note

Ensure that a valid power supply and appropriate load are connected to the Click board to observe proper current and fault condition readings.

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.